package org.flower.web.servlet;

import org.flower.dao.CarouselDao;
import org.flower.dao.impl.CarouselDaoImpl;
import org.flower.entity.Carousel;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;


/**
 * 更新旋转木马servlet
 *
 * @author Aizen
 * @date 2021/12/29
 */
@WebServlet("/manager/updateCarouselServlet.shtml")
public class UpdateCarouselServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String id = request.getParameter("id");
        String val = request.getParameter("val");
        Carousel carousel = new Carousel();
        carousel.setId(Integer.parseInt(id));
        carousel.setAhref(val);
        CarouselDao cd = new CarouselDaoImpl();
        cd.updateCarousel(carousel);
        return;
    }
}
